<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<tpl> $NCharset </tpl>" />
<title><tpl> $langCShopNCSystem </tpl></title>
<tpl>include file ='sys_head_config.html'</tpl>
</head>
<body>
<div class="tabbar">
  <ul class="tab_btns" id="COPYYH2">
    <li class="current"><a href=""><span><tpl> $langExchangeManage </tpl></span></a></li>
  </ul>
	<div class="tab_notes" id="copyyh0">
		<ul class="notesbg block"><span><h4><tpl> $langExchangeManage </tpl><tpl> $langSysExchangeRemark </tpl></h4></span></ul>
	</div>
	<!-- 显示提示信息 -->
	<div id="message"></div>
	<!-- 显示提示信息end -->
</div>

<div id="product-help" class="admincp_form" style="top:88px;">
<div id="result_content">
<form action="exchange.manage.php?action=update" id="form1" name="form1" method="post">
<table class="from_table2_one">
	<thead>
		<tr class="area_ajax_list_title">
			<th class="pd-left" width="15%"><tpl> $langExchangeType </tpl></th>
			<th width="36%"><tpl> $langExchangeRate </tpl></th>
			<th width="24%"><tpl> $langSysExchangeText </tpl></th>
			<th width="15%"><tpl> $langExchangeState </tpl></th>
		</tr>
	</thead>
	<tpl> if $exchange_array[0].exchange_id neq '' </tpl>
		<tpl> section name=i loop=$exchange_array </tpl>
			<tr>	
			  <td class="pd-left" width="15%"><tpl> $exchange_array[i].exchange_name </tpl></td>
				<td width="36%"><input type="text" name="txtexchange_rate[<tpl> $exchange_array[i].exchange_id </tpl>]" id="txtexchange_rate[<tpl> $exchange_array[i].exchange_id </tpl>]"  class="txtinput" value="<tpl> $exchange_array[i].exchange_rate </tpl>" size="8" /></td>
				<td width="20%">
					<input type="text" name="txtexchange_remark[<tpl> $exchange_array[i].exchange_id </tpl>]" style='width:100px;' class="txtinput" value="<tpl> $exchange_array[i].exchange_remark </tpl>" />
				</td>
				<td width="15%">
				<tpl> if $default_exchange neq $exchange_array[i].exchange_name </tpl>
					<input type="radio" name="txtexchange_state[<tpl> $exchange_array[i].exchange_id </tpl>]" value="1" <tpl> if $exchange_array[i].state eq '1' </tpl>checked="checked"<tpl> /if </tpl> /><tpl> $langExchangeStateOpen </tpl>
					<input type="radio" name="txtexchange_state[<tpl> $exchange_array[i].exchange_id </tpl>]" value="0" <tpl> if $exchange_array[i].state eq '0' </tpl>checked="checked"<tpl> /if </tpl> /><tpl> $langExchangeStateClose </tpl>
				<tpl> else </tpl>
					<input type="hidden" name="txtexchange_state[<tpl> $exchange_array[i].exchange_id </tpl>]" value="1" />
					<tpl> $langSysDefaultExchange </tpl>
				<tpl> /if </tpl>
			  </td>
			</tr>
		<tpl> /section </tpl>
		
	<tpl> else  </tpl>
		<tr>
			<td colspan="6"><tpl> $langExchangeNotContent </tpl></td>
		</tr>
	<tpl> /if </tpl>
</table>
<tpl> if $exchange_array[0].exchange_id neq '' </tpl>
<div class="table-5-bottom">
	<div class="p-left">
		<span class="btn_left" >
			<input type="button" name="update" id="update" value="<tpl> $langExchangeSubmit </tpl>" class="btn_submit" />
		</span>
	</div>
</div>
<tpl> /if </tpl>
</form>
</div>
</div>
<!-- 帮助菜单 -->
<tpl> include file='sys_right_help.html' </tpl>
<!-- 帮助菜单END -->
</body>
</html>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
	hideLoading();
	
	var options = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
					},
		type:      'post',
		dataType:  'json'
	};

	//提交
	$("#update").click(function(){
		var sign = true
		var strP=/^\d+(\.\d+)?$/;
		$('#form1 input[@type=text]').each(function(){
			//验证汇率是否为数字
			if(this.name.indexOf("txtexchange_rate") >= 0){
				if(!this.value) {
					return false;
				}
				if(!strP.test(this.value)){
					sign = false;
				}else{
					if(parseFloat(this.value) != this.value || parseFloat(this.value) == 0) {
						sign = false;
					}
				}
			}
		});
		
		if(sign == true){
			$('#form1').ajaxSubmit(options);
		}else{
			showMessage("<tpl> $langExchangeValueIsWrong </tpl>");
		}
	});
});
</script>